import http from '@ohos.net.http';
import router from '@system.router';
export default {
    data: {
        title: 'World',
        imagesrc1:"/common/shangpin/shangpin1.png",
        imagesrc2:"/common/shangpin/shangpin2.png",
        imagesrc3:"/common/shangpin/shangpin3.png",
        imagesrc4:"/common/shangpin/shangpin4.png",
        imagesrc5:"/common/shangpin/shangpin5.png",
        imagesrc6:"/common/shangpin/shangpin6.png",
        imagesrc7:"/common/shangpin/shangpin7.png",
        imagesrc8:"/common/shangpin/shangpin8.png",
        imagesrc9:"/common/shangpin/shangpin9.jpg",
        imagesrc10:"/common/shangpin/shangpin10.jpg",
        imagesrc11:"/common/shangpin/shangpin11.png",
        imagesrc12:"/common/shangpin/shangpin12.png",
        imagesrc13:"/common/shangpin/shangpin13.png",
        imagesrc14:"/common/shangpin/shangpin14.png",
        imagesrc15:"/common/shangpin/shangpin15.png",
        badgeconfig:{
            textColor:"#ffffff",
            badgeSize:"7px",
            badgeColor:"#f65d0b"
        },
        toumingdu:1,
        shangpin:[
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080ti-12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080-8G-GAMING",color:"#ff5900",color2:"#ff5900"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"ROG-RTX3070ti-O12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"ROG-RTX3070-O12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3060ti-O12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"ROG-RTX3060-12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"ROG-RTX3050-O12G-GAMING-Ultra-OC",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080ti-12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080ti-O12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080ti-12G-GAMING",color:"white",color2:"black"},
            {imagesrc:"/common/shangpin/shangpin10.jpg",name:"TUF-RTX3080ti-12G-GAMING",color:"white",color2:"black"},
        ],
        tiaozhuansit:0,
    },
    goBack(){
        router.back();
    },
    gouwuche(){
        console.log("购物车被点击");
        this.toumingdu = 0.5;
        this.$element("simplepanel").show();
        this.tiaozhuansit = 1;
    },
    lijigoumai(){
        console.log("立即购买被点击");
        this.toumingdu = 0.5;
        this.$element('simplepanel').show();
        this.tiaozhuansit = 2;
    },
    fanhui(){
        router.back();
    },
    closepanel(){
        this.$element("simplepanel").close();
        this.toumingdu = 1;
    },
    changesize(e){
        e.mode = "full";
    },
    buttonclick(){
        let httpRequest1 = http.createHttp();
        httpRequest1.request(this.$app.$def.globalData.baseURL + "/gouwuche", {
            method: 'PUT',
        }, (err, data) => {
            if (!err) {
                console.error('Result:' + data.result);
                this.shangpin1 = JSON.parse(data.result);
                console.error('Neirong:'+this.neirong1);
            } else {
                console.log('error:' + err.data);
            }
        });
        if(this.tiaozhuansit==1){
            router.push({
                uri:"pages/shouye/shouye",
            })
        }
        else{
            router.push({
                uri:"pages/jiesuan/jiesuan",
            })
        }
    },
    textclick(e){
        console.log("元素被点击");
        if(this.shangpin[e].color=="#ff5900"&&this.shangpin[e].color2=="#ff5900"){
            this.shangpin[e].color="white";
            this.shangpin[e].color2="black";
            console.log("进判断1"+e);
        }
        else{
            this.shangpin[e].color="#ff5900";
            this.shangpin[e].color2="#ff5900";
        }
    }
}
